#include <iostream>
#include <pthread.h>
#include <functional>

typedef void *(*fun_t)(void *);

class Thread
{
public:
    Thread(const std::string& name, fun_t fun, void* mes)
        : _name(name)
        , _fun(fun)
        , _mes(mes)
    {}

    void Create()
    {
        pthread_create(&_pid, nullptr, _fun, _mes);
    }

    void Join()
    {
        pthread_join(_pid, nullptr);
    }

private:
    std::string _name;
    fun_t _fun;
    pthread_t _pid;
    void* _mes;
};